package main;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import controller.Controller;

public final class Messenger extends MIDlet {
	
	private boolean initialized;
	private Controller controller;
	
	private void init() {
		controller = new Controller(this);
		controller.init();
	}
	
	/* MIDlet Methods */
	protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
	}

	protected void pauseApp() {
		controller.cleanup();
		System.gc();
	}

	protected void startApp() throws MIDletStateChangeException {
		if (!initialized) {
			init();
		}
	}
}
